package com.eudon.design_pattern.behavioral.command;

import java.util.LinkedList;
import java.util.List;
import java.util.Queue;

/**
 * @author eudon
 * @description 使用示例
 * @date 2025/9/3
 * @email syd19970616@gmail.com
 * @address <a href="https://gitee.com/eudon">Gitee</a>
 */
public class Use {
    private static final Queue<Command> COMMANDS = new LinkedList<>();

    public static void main(String[] args) {
        List<String> eventList = new LinkedList<>();
        eventList.add("A");
        eventList.add("B");
        eventList.add("C");

        eventList.forEach(event ->{
            if(event.equals("A")){
                COMMANDS.add(new ACommand());
            }else if(event.equals("B")){
                COMMANDS.add(new BCommand());
            }else if(event.equals("C")){
                COMMANDS.add(new CCommand());
            }
        });

        COMMANDS.forEach(Command::execute);
    }
}
